package com.icedata.sika.bridge

import net.mamoe.mirai.message.data.QuoteReply

/**
 * Sika对Mirai中QuoteReply的半包装
 * 这个Quote只能用来获取原来信息的文本信息
 */
@MiraiBasedAPI
@MiraiSpecialAPI
class SikaQuoteMessage(private val miraiQuoteMessage: QuoteReply) : SikaSingleMessage(miraiQuoteMessage) {

    /**
     * 这个构造方法是由用户调用的
     * 这个构造方法是用来接收SikaMessageChain对象，然后实现
     */
    @UserSikaAPI
    constructor(messageChain: SikaMessageChain) : this(QuoteReply(messageChain.miraiMessageChain))

    override fun contentToString(): String {
        return "[Sika:Quote]"
    }

    /**
     * 获取引用的那个消息
     *
     * @return 所引用的Sika消息
     */
    val originMessageChain: SikaMessageChain by lazy {
        return@lazy SikaMessageChain(miraiQuoteMessage.source.originalMessage)
    }

    @MiraiBasedAPI
    override fun toString(): String {
        return "[Sika:Quote:${miraiQuoteMessage.source.originalMessage.contentToString()}]"
    }

}